import { reactive } from 'vue'
export interface tabTypes {
  list: { active: boolean; title: string; slideIndex: number }[]
}
export function useTab(): [tabTypes, (index: number) => void] {
  const tab = reactive<tabTypes>({
    list: [
      { active: true, title: '首页', slideIndex: 1 },
      { active: false, title: '产品功能', slideIndex: 2 },
      { active: false, title: '解决方案', slideIndex: 3 },
      { active: false, title: '商家案例', slideIndex: 4 },
      { active: false, title: '客户支持', slideIndex: 5 },
      { active: false, title: '联系我们', slideIndex: 6 },
    ],
  })
  function activation(index: number) {
    tab.list.forEach(listItem => {
      listItem.active = false
    })
    tab.list[index].active = true
  }
  return [tab, activation]
}
